home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / New System Software Extensions / QuickDraw™ 3D 1.0 / Development / Interfaces / QD3DMath.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-02  |  24.0 KB  |  880 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DMath.h                                                 **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Math & matrix routines and definitions.                     **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          ** 
  13.  *****************************************************************************/
  14. #ifndef QD3DMath_h
  15. #define QD3DMath_h
  16.  
  17. #ifndef QD3D_h
  18. #include "QD3D.h"
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #include <math.h>
  26. #include <float.h>
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif    /* __cplusplus */
  31.  
  32. /******************************************************************************
  33.  **                                                                             **
  34.  **                            Constant Definitions                             **
  35.  **                                                                             **
  36.  *****************************************************************************/
  37. /*
  38.  *  Real zero definition
  39.  */
  40. #ifdef FLT_EPSILON
  41. #    define kQ3RealZero            (FLT_EPSILON)
  42. #else
  43. #    define kQ3RealZero            ((float)1.19209290e-07)            
  44. #endif  /*  FLT_EPSILON  */
  45.  
  46. #ifdef FLT_MAX
  47. #    define    kQ3MaxFloat            (FLT_MAX)
  48. #else
  49. #    define    kQ3MaxFloat            ((float)3.40282347e+38)
  50. #endif  /*  FLT_MAX  */
  51.  
  52. /*
  53.  *  Values of PI
  54.  */
  55. #define kQ3Pi                     ((float)3.1415926535898)
  56. #define kQ32Pi                     ((float)(2.0 * 3.1415926535898))
  57. #define kQ3PiOver2                ((float)(3.1415926535898 / 2.0))
  58. #define kQ33PiOver2                ((float)(3.0 * 3.1415926535898 / 2.0))
  59.  
  60.  
  61. /******************************************************************************
  62.  **                                                                             **
  63.  **                            Miscellaneous Functions                             **
  64.  **                                                                             **
  65.  *****************************************************************************/
  66.  
  67. #define Q3Math_DegreesToRadians(x)    ((float)((x) *  kQ3Pi / 180.0))
  68. #define Q3Math_RadiansToDegrees(x)    ((float)((x) * 180.0 / kQ3Pi))
  69.  
  70. #define Q3Math_Min(x,y)                ((x) <= (y) ? (x) : (y))
  71. #define Q3Math_Max(x,y)                ((x) >= (y) ? (x) : (y))
  72.  
  73.         
  74. /******************************************************************************
  75.  **                                                                             **
  76.  **                            Point and Vector Creation                         **
  77.  **                                                                             **
  78.  *****************************************************************************/
  79.  
  80. QD3D_EXPORT TQ3Point2D *Q3Point2D_Set(
  81.     TQ3Point2D                    *point2D,
  82.     float                        x, 
  83.     float                        y);
  84.  
  85. QD3D_EXPORT TQ3Param2D *Q3Param2D_Set(
  86.     TQ3Param2D                    *param2D,
  87.     float                        u, 
  88.     float                        v);
  89.  
  90. QD3D_EXPORT TQ3Point3D *Q3Point3D_Set(
  91.     TQ3Point3D                    *point3D,
  92.     float                        x, 
  93.     float                        y, 
  94.     float                        z);
  95.  
  96. QD3D_EXPORT TQ3RationalPoint3D *Q3RationalPoint3D_Set(
  97.     TQ3RationalPoint3D            *point3D,
  98.     float                        x, 
  99.     float                        y, 
  100.     float                        w);
  101.     
  102. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_Set(
  103.     TQ3RationalPoint4D            *point4D,
  104.     float                        x,
  105.     float                        y,
  106.     float                        z, 
  107.     float                        w);
  108.     
  109. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Set(
  110.     TQ3Vector2D                    *vector2D,
  111.     float                        x, 
  112.     float                        y);
  113.  
  114. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Set(
  115.     TQ3Vector3D                    *vector3D,
  116.     float                        x, 
  117.     float                        y, 
  118.     float                        z);
  119.  
  120. QD3D_EXPORT TQ3PolarPoint *Q3PolarPoint_Set(
  121.     TQ3PolarPoint                *polarPoint,
  122.     float                        r,
  123.     float                        theta);
  124.  
  125. QD3D_EXPORT TQ3SphericalPoint *Q3SphericalPoint_Set(
  126.     TQ3SphericalPoint            *sphericalPoint,
  127.     float                        rho,
  128.     float                        theta,
  129.     float                        phi);
  130.     
  131.     
  132. /******************************************************************************
  133.  **                                                                             **
  134.  **                    Point and Vector Dimension Conversion                     **
  135.  **                                                                             **
  136.  *****************************************************************************/
  137.  
  138. QD3D_EXPORT TQ3Point3D *Q3Point2D_To3D(
  139.     const TQ3Point2D            *point2D,
  140.     TQ3Point3D                    *result);
  141.  
  142. QD3D_EXPORT TQ3Point2D *Q3RationalPoint3D_To2D(
  143.     const TQ3RationalPoint3D    *point3D,
  144.     TQ3Point2D                    *result);
  145.     
  146. QD3D_EXPORT TQ3RationalPoint4D *Q3Point3D_To4D(
  147.     const TQ3Point3D            *point3D,
  148.     TQ3RationalPoint4D            *result);
  149.  
  150. QD3D_EXPORT TQ3Point3D *Q3RationalPoint4D_To3D(
  151.     const TQ3RationalPoint4D    *point4D,
  152.     TQ3Point3D                    *result);
  153.  
  154. QD3D_EXPORT TQ3Vector3D *Q3Vector2D_To3D(
  155.     const TQ3Vector2D            *vector2D,
  156.     TQ3Vector3D                    *result);
  157.     
  158. QD3D_EXPORT TQ3Vector2D *Q3Vector3D_To2D(
  159.     const TQ3Vector3D            *vector3D,
  160.     TQ3Vector2D                    *result);
  161.  
  162.     
  163. /******************************************************************************
  164.  **                                                                             **
  165.  **                            Point Subtraction                                 **
  166.  **                                                                             **
  167.  *****************************************************************************/
  168.  
  169. QD3D_EXPORT TQ3Vector2D *Q3Point2D_Subtract(
  170.     const TQ3Point2D            *p1, 
  171.     const TQ3Point2D            *p2,
  172.     TQ3Vector2D                    *result);
  173.  
  174. QD3D_EXPORT TQ3Vector2D *Q3Param2D_Subtract(
  175.     const TQ3Param2D            *p1, 
  176.     const TQ3Param2D            *p2,
  177.     TQ3Vector2D                    *result);
  178.  
  179. QD3D_EXPORT TQ3Vector3D *Q3Point3D_Subtract(
  180.     const TQ3Point3D            *p1, 
  181.     const TQ3Point3D            *p2,
  182.     TQ3Vector3D                    *result);
  183.     
  184.     
  185. /******************************************************************************
  186.  **                                                                             **
  187.  **                            Point Distance                                     **
  188.  **                                                                             **
  189.  *****************************************************************************/
  190.     
  191. QD3D_EXPORT float Q3Point2D_Distance(
  192.     const TQ3Point2D            *p1, 
  193.     const TQ3Point2D            *p2);
  194.  
  195. QD3D_EXPORT float Q3Point2D_DistanceSquared(
  196.     const TQ3Point2D            *p1, 
  197.     const TQ3Point2D            *p2);
  198.  
  199.  
  200. QD3D_EXPORT float Q3Param2D_Distance(
  201.     const TQ3Param2D            *p1, 
  202.     const TQ3Param2D            *p2);
  203.  
  204. QD3D_EXPORT float Q3Param2D_DistanceSquared(
  205.     const TQ3Param2D            *p1, 
  206.     const TQ3Param2D            *p2);
  207.     
  208.     
  209. QD3D_EXPORT float Q3RationalPoint3D_Distance(
  210.     const TQ3RationalPoint3D    *p1, 
  211.     const TQ3RationalPoint3D    *p2);
  212.     
  213. QD3D_EXPORT float Q3RationalPoint3D_DistanceSquared(
  214.     const TQ3RationalPoint3D    *p1, 
  215.     const TQ3RationalPoint3D    *p2);
  216.  
  217.  
  218. QD3D_EXPORT float Q3Point3D_Distance(
  219.     const TQ3Point3D            *p1, 
  220.     const TQ3Point3D            *p2);
  221.  
  222. QD3D_EXPORT float Q3Point3D_DistanceSquared(
  223.     const TQ3Point3D            *p1, 
  224.     const TQ3Point3D            *p2);
  225.  
  226.  
  227. QD3D_EXPORT float Q3RationalPoint4D_Distance(
  228.     const TQ3RationalPoint4D    *p1, 
  229.     const TQ3RationalPoint4D    *p2);
  230.  
  231. QD3D_EXPORT float Q3RationalPoint4D_DistanceSquared(
  232.     const TQ3RationalPoint4D    *p1, 
  233.     const TQ3RationalPoint4D    *p2);
  234.  
  235.  
  236. /******************************************************************************
  237.  **                                                                             **
  238.  **                            Point Relative Ratio                             **
  239.  **                                                                             **
  240.  *****************************************************************************/
  241.  
  242. QD3D_EXPORT TQ3Point2D *Q3Point2D_RRatio(
  243.     const TQ3Point2D            *p1,
  244.     const TQ3Point2D            *p2,
  245.     float                        r1,
  246.     float                        r2,
  247.     TQ3Point2D                    *result);
  248.  
  249. QD3D_EXPORT TQ3Param2D *Q3Param2D_RRatio(
  250.     const TQ3Param2D            *p1,
  251.     const TQ3Param2D            *p2,
  252.     float                        r1,
  253.     float                        r2,
  254.     TQ3Param2D                    *result);
  255.  
  256. QD3D_EXPORT TQ3Point3D *Q3Point3D_RRatio(
  257.     const TQ3Point3D            *p1,
  258.     const TQ3Point3D            *p2,
  259.     float                        r1,
  260.     float                        r2,
  261.     TQ3Point3D                    *result);
  262.  
  263. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_RRatio(
  264.     const TQ3RationalPoint4D    *p1,
  265.     const TQ3RationalPoint4D    *p2,
  266.     float                        r1,
  267.     float                        r2,
  268.     TQ3RationalPoint4D            *result);
  269.                         
  270.                         
  271. /******************************************************************************
  272.  **                                                                             **
  273.  **                    Point / Vector Addition    & Subtraction                     **
  274.  **                                                                             **
  275.  *****************************************************************************/
  276.  
  277. QD3D_EXPORT TQ3Point2D *Q3Point2D_Vector2D_Add(
  278.     const TQ3Point2D            *point2D, 
  279.     const TQ3Vector2D            *vector2D,
  280.     TQ3Point2D                    *result);
  281.  
  282. QD3D_EXPORT TQ3Param2D *Q3Param2D_Vector2D_Add(
  283.     const TQ3Param2D            *param2D, 
  284.     const TQ3Vector2D            *vector2D,
  285.     TQ3Param2D                    *result);
  286.  
  287. QD3D_EXPORT TQ3Point3D *Q3Point3D_Vector3D_Add(
  288.     const TQ3Point3D            *point3D, 
  289.     const TQ3Vector3D            *vector3D,
  290.     TQ3Point3D                    *result);
  291.  
  292. QD3D_EXPORT TQ3Point2D *Q3Point2D_Vector2D_Subtract(
  293.     const TQ3Point2D            *point2D, 
  294.     const TQ3Vector2D            *vector2D,
  295.     TQ3Point2D                    *result);
  296.  
  297. QD3D_EXPORT TQ3Param2D *Q3Param2D_Vector2D_Subtract(
  298.     const TQ3Param2D            *param2D, 
  299.     const TQ3Vector2D            *vector2D,
  300.     TQ3Param2D                    *result);
  301.  
  302. QD3D_EXPORT TQ3Point3D *Q3Point3D_Vector3D_Subtract(
  303.     const TQ3Point3D            *point3D, 
  304.     const TQ3Vector3D            *vector3D,
  305.     TQ3Point3D                    *result);
  306.  
  307.  
  308. /******************************************************************************
  309.  **                                                                             **
  310.  **                                Vector Scale                                 **
  311.  **                                                                             **
  312.  *****************************************************************************/
  313.                         
  314. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Scale(
  315.     const TQ3Vector2D            *vector2D, 
  316.     float                        scalar,
  317.     TQ3Vector2D                    *result);
  318.  
  319. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Scale(
  320.     const TQ3Vector3D            *vector3D, 
  321.     float                        scalar,
  322.     TQ3Vector3D                    *result);
  323.  
  324.     
  325. /******************************************************************************
  326.  **                                                                             **
  327.  **                                Vector Length                                 **
  328.  **                                                                             **
  329.  *****************************************************************************/
  330.  
  331. QD3D_EXPORT float Q3Vector2D_Length(
  332.     const TQ3Vector2D             *vector2D);
  333.  
  334. QD3D_EXPORT float Q3Vector3D_Length(
  335.     const TQ3Vector3D            *vector3D);
  336.  
  337.     
  338. /******************************************************************************
  339.  **                                                                             **
  340.  **                                Vector Normalize                             **
  341.  **                                                                             **
  342.  *****************************************************************************/
  343.  
  344. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Normalize(
  345.     const TQ3Vector2D            *vector2D,
  346.     TQ3Vector2D                    *result);
  347.  
  348. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Normalize(
  349.     const TQ3Vector3D            *vector3D,
  350.     TQ3Vector3D                    *result);
  351.  
  352.  
  353. /******************************************************************************
  354.  **                                                                             **
  355.  **                    Vector/Vector Addition and Subtraction                     **
  356.  **                                                                             **
  357.  *****************************************************************************/
  358.  
  359. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Add(
  360.     const TQ3Vector2D            *v1, 
  361.     const TQ3Vector2D            *v2,
  362.     TQ3Vector2D                    *result);
  363.  
  364. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Add(
  365.     const TQ3Vector3D            *v1, 
  366.     const TQ3Vector3D            *v2, 
  367.     TQ3Vector3D                    *result);
  368.  
  369.  
  370. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Subtract(
  371.     const TQ3Vector2D            *v1, 
  372.     const TQ3Vector2D            *v2, 
  373.     TQ3Vector2D                    *result);
  374.  
  375. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Subtract(
  376.     const TQ3Vector3D            *v1, 
  377.     const TQ3Vector3D            *v2,
  378.     TQ3Vector3D                    *result);
  379.  
  380.  
  381. /******************************************************************************
  382.  **                                                                             **
  383.  **                                Cross Product                                 **
  384.  **                                                                             **
  385.  *****************************************************************************/
  386.  
  387. QD3D_EXPORT float Q3Vector2D_Cross(
  388.     const TQ3Vector2D            *v1, 
  389.     const TQ3Vector2D            *v2);
  390.  
  391. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Cross(
  392.     const TQ3Vector3D            *v1, 
  393.     const TQ3Vector3D            *v2,
  394.     TQ3Vector3D                    *result);
  395.     
  396. QD3D_EXPORT TQ3Vector3D *Q3Point3D_CrossProductTri(
  397.     const TQ3Point3D             *point1, 
  398.     const TQ3Point3D             *point2, 
  399.     const TQ3Point3D             *point3, 
  400.     TQ3Vector3D                 *crossVector);
  401.  
  402.  
  403. /******************************************************************************
  404.  **                                                                             **
  405.  **                                Dot Product                                     **
  406.  **                                                                             **
  407.  *****************************************************************************/
  408.  
  409. QD3D_EXPORT float Q3Vector2D_Dot(
  410.     const TQ3Vector2D            *v1, 
  411.     const TQ3Vector2D            *v2);
  412.  
  413. QD3D_EXPORT float Q3Vector3D_Dot(
  414.     const TQ3Vector3D            *v1, 
  415.     const TQ3Vector3D            *v2);
  416.  
  417.  
  418. /******************************************************************************
  419.  **                                                                             **
  420.  **                        Point and Vector Transformation                         **
  421.  **                                                                             **
  422.  *****************************************************************************/
  423.  
  424. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Transform(
  425.     const TQ3Vector2D            *vector2D,
  426.     const TQ3Matrix3x3             *matrix3x3,
  427.     TQ3Vector2D                    *result);
  428.     
  429. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Transform(
  430.     const TQ3Vector3D            *vector3D,
  431.     const TQ3Matrix4x4            *matrix4x4,
  432.     TQ3Vector3D                    *result);
  433.  
  434. QD3D_EXPORT TQ3Point2D *Q3Point2D_Transform(
  435.     const TQ3Point2D             *point2D,
  436.     const TQ3Matrix3x3            *matrix3x3,
  437.     TQ3Point2D                    *result);
  438.  
  439. QD3D_EXPORT TQ3Param2D *Q3Param2D_Transform(
  440.     const TQ3Param2D             *param2D,
  441.     const TQ3Matrix3x3            *matrix3x3,
  442.     TQ3Param2D                    *result);
  443.  
  444. QD3D_EXPORT TQ3Point3D *Q3Point3D_Transform(
  445.     const TQ3Point3D            *point3D,
  446.     const TQ3Matrix4x4            *matrix4x4,
  447.     TQ3Point3D                    *result);
  448.  
  449. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_Transform(
  450.     const TQ3RationalPoint4D    *point4D, 
  451.     const TQ3Matrix4x4            *matrix4x4,
  452.     TQ3RationalPoint4D            *result);
  453.     
  454. QD3D_EXPORT TQ3Status Q3Point3D_To3DTransformArray(
  455.     const TQ3Point3D             *inVertex, 
  456.     const TQ3Matrix4x4             *matrix,
  457.     TQ3Point3D                     *outVertex,  
  458.     long                         numVertices, 
  459.     unsigned long                 inStructSize, 
  460.     unsigned long                 outStructSize);
  461.     
  462. QD3D_EXPORT TQ3Status Q3Point3D_To4DTransformArray(
  463.     const TQ3Point3D             *inVertex, 
  464.     const TQ3Matrix4x4             *matrix,
  465.     TQ3RationalPoint4D             *outVertex,  
  466.     long                         numVertices,
  467.     unsigned long                 inStructSize, 
  468.     unsigned long                 outStructSize);
  469.     
  470. QD3D_EXPORT TQ3Status Q3RationalPoint4D_To4DTransformArray(
  471.     const TQ3RationalPoint4D     *inVertex, 
  472.     const TQ3Matrix4x4             *matrix,
  473.     TQ3RationalPoint4D             *outVertex,  
  474.     long                         numVertices, 
  475.     unsigned long                 inStructSize, 
  476.     unsigned long                 outStructSize);
  477.  
  478.  
  479. /******************************************************************************
  480.  **                                                                             **
  481.  **                                Vector Negation                                 **
  482.  **                                                                             **
  483.  *****************************************************************************/
  484.  
  485. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Negate(
  486.     const TQ3Vector2D            *vector2D,
  487.     TQ3Vector2D                    *result);
  488.  
  489. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Negate(
  490.     const TQ3Vector3D            *vector3D,
  491.     TQ3Vector3D                    *result);
  492.  
  493.  
  494. /******************************************************************************
  495.  **                                                                             **
  496.  **                    Point conversion from cartesian to polar                 **
  497.  **                                                                             **
  498.  *****************************************************************************/
  499.  
  500. QD3D_EXPORT TQ3PolarPoint *Q3Point2D_ToPolar(
  501.     const TQ3Point2D            *point2D,
  502.     TQ3PolarPoint                *result);
  503.     
  504. QD3D_EXPORT TQ3Point2D *Q3PolarPoint_ToPoint2D(
  505.     const TQ3PolarPoint            *polarPoint,
  506.     TQ3Point2D                    *result);
  507.     
  508. QD3D_EXPORT TQ3SphericalPoint *Q3Point3D_ToSpherical(
  509.     const TQ3Point3D            *point3D,
  510.     TQ3SphericalPoint            *result);
  511.     
  512. QD3D_EXPORT TQ3Point3D *Q3SphericalPoint_ToPoint3D(
  513.     const TQ3SphericalPoint        *sphericalPoint,
  514.     TQ3Point3D                    *result);
  515.  
  516.  
  517. /******************************************************************************
  518.  **                                                                             **
  519.  **                            Point Affine Combinations                         **
  520.  **                                                                             **
  521.  *****************************************************************************/
  522.  
  523. QD3D_EXPORT TQ3Point2D *Q3Point2D_AffineComb(
  524.     const TQ3Point2D            *points2D,
  525.     const float                    *weights,
  526.     unsigned long                nPoints, 
  527.     TQ3Point2D                    *result);
  528.  
  529. QD3D_EXPORT TQ3Param2D *Q3Param2D_AffineComb(
  530.     const TQ3Param2D            *param2Ds,
  531.     const float                    *weights,
  532.     unsigned long                nPoints, 
  533.     TQ3Param2D                    *result);
  534.  
  535. QD3D_EXPORT TQ3RationalPoint3D *Q3RationalPoint3D_AffineComb(
  536.     const TQ3RationalPoint3D    *points3D,
  537.     const float                    *weights,
  538.     unsigned long                nPoints, 
  539.     TQ3RationalPoint3D            *result);
  540.     
  541. QD3D_EXPORT TQ3Point3D *Q3Point3D_AffineComb(
  542.     const TQ3Point3D            *points3D,
  543.     const float                    *weights,
  544.     unsigned long                nPoints, 
  545.     TQ3Point3D                    *result);
  546.  
  547. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_AffineComb(
  548.     const TQ3RationalPoint4D    *points4D,
  549.     const float                    *weights,
  550.     unsigned long                nPoints, 
  551.     TQ3RationalPoint4D            *result);
  552.     
  553.     
  554. /******************************************************************************
  555.  **                                                                             **
  556.  **                                Matrix Functions                             **
  557.  **                                                                             **
  558.  *****************************************************************************/
  559.  
  560. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Copy(
  561.     const TQ3Matrix3x3            *matrix3x3,
  562.     TQ3Matrix3x3                *result);
  563.     
  564. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Copy(
  565.     const TQ3Matrix4x4            *matrix4x4,
  566.     TQ3Matrix4x4                *result);
  567.  
  568.  
  569. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetIdentity(
  570.     TQ3Matrix3x3                *matrix3x3);
  571.  
  572. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetIdentity(
  573.     TQ3Matrix4x4                *matrix4x4);
  574.  
  575.  
  576. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Transpose(
  577.     const TQ3Matrix3x3            *matrix3x3,
  578.     TQ3Matrix3x3                *result);
  579.  
  580. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Transpose(
  581.     const TQ3Matrix4x4            *matrix4x4,
  582.     TQ3Matrix4x4                *result);
  583.  
  584.  
  585. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Invert(
  586.     const TQ3Matrix3x3            *matrix3x3,
  587.     TQ3Matrix3x3                *result);
  588.  
  589. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Invert(
  590.     const TQ3Matrix4x4            *matrix4x4,
  591.     TQ3Matrix4x4                *result);
  592.     
  593.     
  594. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Adjoint(
  595.     const TQ3Matrix3x3            *matrix3x3,
  596.     TQ3Matrix3x3                *result);
  597.  
  598.  
  599. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Multiply(
  600.     const TQ3Matrix3x3            *matrixA,
  601.     const TQ3Matrix3x3            *matrixB,
  602.     TQ3Matrix3x3                *result);
  603.  
  604. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Multiply(
  605.     const TQ3Matrix4x4            *matrixA,
  606.     const TQ3Matrix4x4            *matrixB,
  607.     TQ3Matrix4x4                *result);
  608.  
  609.  
  610. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetTranslate(
  611.     TQ3Matrix3x3                *matrix3x3,    
  612.     float                        xTrans,
  613.     float                        yTrans);
  614.  
  615. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetScale(
  616.     TQ3Matrix3x3                *matrix3x3,
  617.     float                        xScale,
  618.     float                        yScale);
  619.  
  620.  
  621. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetRotateAboutPoint(
  622.     TQ3Matrix3x3                *matrix3x3,
  623.     const TQ3Point2D            *origin,
  624.     float                        angle);
  625.  
  626. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetTranslate(
  627.     TQ3Matrix4x4                *matrix4x4,
  628.     float                        xTrans,
  629.     float                        yTrans,
  630.     float                        zTrans);
  631.  
  632. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetScale(
  633.     TQ3Matrix4x4                *matrix4x4,
  634.     float                        xScale,
  635.     float                        yScale,
  636.     float                        zScale);
  637.  
  638.  
  639. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateAboutPoint(
  640.     TQ3Matrix4x4                *matrix4x4,
  641.     const TQ3Point3D            *origin,
  642.     float                        xAngle,
  643.     float                        yAngle,
  644.     float                        zAngle);
  645.     
  646. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateAboutAxis(
  647.     TQ3Matrix4x4                *matrix4x4,
  648.     const TQ3Point3D            *origin,
  649.     const TQ3Vector3D            *orientation,   
  650.     float                        angle);    
  651.     
  652. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_X(
  653.     TQ3Matrix4x4                *matrix4x4,
  654.     float                        angle);
  655.     
  656. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_Y(
  657.     TQ3Matrix4x4                *matrix4x4,
  658.     float                        angle);
  659.  
  660. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_Z(
  661.     TQ3Matrix4x4                *matrix4x4,
  662.     float                        angle);
  663.         
  664. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_XYZ(
  665.     TQ3Matrix4x4                *matrix4x4,
  666.     float                        xAngle,
  667.     float                        yAngle,
  668.     float                        zAngle);                            
  669.                             
  670. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateVectorToVector(
  671.     TQ3Matrix4x4                *matrix4x4,
  672.     const TQ3Vector3D            *v1,
  673.     const TQ3Vector3D            *v2);
  674.  
  675. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetQuaternion(
  676.     TQ3Matrix4x4                 *matrix, 
  677.     const TQ3Quaternion         *quaternion);
  678.  
  679. QD3D_EXPORT float Q3Matrix3x3_Determinant(
  680.     const TQ3Matrix3x3            *matrix3x3);
  681.  
  682. QD3D_EXPORT float Q3Matrix4x4_Determinant(
  683.     const TQ3Matrix4x4            *matrix4x4);
  684.     
  685.     
  686. /******************************************************************************
  687.  **                                                                             **
  688.  **                                Quaternion Routines                             **
  689.  **                                                                             **
  690.  *****************************************************************************/
  691.  
  692. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Set(
  693.     TQ3Quaternion                *quaternion,
  694.     float                        w,
  695.     float                        x,
  696.     float                        y,
  697.     float                        z);
  698.     
  699. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetIdentity(
  700.     TQ3Quaternion                *quaternion);
  701.     
  702. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Copy(
  703.     const TQ3Quaternion            *quaternion, 
  704.     TQ3Quaternion                 *result);
  705.  
  706. QD3D_EXPORT TQ3Boolean Q3Quaternion_IsIdentity(
  707.     const TQ3Quaternion            *quaternion);
  708.  
  709. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Invert(
  710.     const TQ3Quaternion         *quaternion,
  711.     TQ3Quaternion                *result);
  712.  
  713. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Normalize(
  714.     const TQ3Quaternion            *quaternion,
  715.     TQ3Quaternion                *result);
  716.  
  717. QD3D_EXPORT float Q3Quaternion_Dot(
  718.     const TQ3Quaternion         *q1, 
  719.     const TQ3Quaternion         *q2);
  720.  
  721. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Multiply(
  722.     const TQ3Quaternion            *q1, 
  723.     const TQ3Quaternion            *q2,
  724.     TQ3Quaternion                *result);
  725.  
  726. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateAboutAxis(
  727.     TQ3Quaternion                 *quaternion, 
  728.     const TQ3Vector3D             *axis, 
  729.     float                         angle);
  730.     
  731. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateXYZ(
  732.     TQ3Quaternion                 *quaternion, 
  733.     float                         xAngle, 
  734.     float                         yAngle, 
  735.     float                         zAngle);
  736.     
  737. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateX(
  738.     TQ3Quaternion                 *quaternion, 
  739.     float                         angle);
  740.  
  741. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateY(
  742.     TQ3Quaternion                 *quaternion, 
  743.     float                         angle);
  744.  
  745. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateZ(
  746.     TQ3Quaternion                 *quaternion, 
  747.     float                         angle);
  748.  
  749. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetMatrix(
  750.     TQ3Quaternion                 *quaternion, 
  751.     const TQ3Matrix4x4             *matrix);
  752.  
  753. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateVectorToVector(
  754.     TQ3Quaternion                 *quaternion, 
  755.     const TQ3Vector3D             *v1, 
  756.     const TQ3Vector3D             *v2);
  757.  
  758. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_MatchReflection(
  759.     const TQ3Quaternion            *q1, 
  760.     const TQ3Quaternion         *q2,
  761.     TQ3Quaternion                *result);
  762.  
  763. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_InterpolateFast(
  764.     const TQ3Quaternion         *q1, 
  765.     const TQ3Quaternion         *q2, 
  766.     float                         t,
  767.     TQ3Quaternion                *result);
  768.  
  769. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_InterpolateLinear(
  770.     const TQ3Quaternion         *q1, 
  771.     const TQ3Quaternion         *q2, 
  772.     float                         t,
  773.     TQ3Quaternion                 *result);
  774.  
  775. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_TransformQuaternion(
  776.     const TQ3Vector3D             *vector, 
  777.     const TQ3Quaternion         *quaternion,
  778.     TQ3Vector3D                    *result);
  779.  
  780. QD3D_EXPORT TQ3Point3D *Q3Point3D_TransformQuaternion(
  781.     const TQ3Point3D             *vector, 
  782.     const TQ3Quaternion         *quaternion,
  783.     TQ3Point3D                    *result);
  784.  
  785.  
  786. /******************************************************************************
  787.  **                                                                             **
  788.  **                                Volume Routines                                 **
  789.  **                                                                             **
  790.  *****************************************************************************/
  791.  
  792. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Copy(
  793.     const TQ3BoundingBox         *src, 
  794.     TQ3BoundingBox                 *dest);
  795.     
  796. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Union(
  797.     const TQ3BoundingBox         *v1, 
  798.     const TQ3BoundingBox         *v2,
  799.     TQ3BoundingBox                *result);
  800.     
  801. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Set(
  802.     TQ3BoundingBox                 *bBox,
  803.     const TQ3Point3D             *min, 
  804.     const TQ3Point3D             *max,
  805.     TQ3Boolean                    isEmpty);
  806.     
  807. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_UnionPoint3D(
  808.     const TQ3BoundingBox         *bBox,
  809.     const TQ3Point3D             *pt3D,
  810.     TQ3BoundingBox                *result);
  811.     
  812. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_UnionRationalPoint4D(
  813.     const TQ3BoundingBox         *bBox,
  814.     const TQ3RationalPoint4D     *pt4D, 
  815.     TQ3BoundingBox                 *result);
  816.  
  817. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_SetFromPoints3D(
  818.     TQ3BoundingBox                 *bBox, 
  819.     const TQ3Point3D             *pts, 
  820.     unsigned long                 nPts,
  821.     unsigned long                structSize);
  822.     
  823. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_SetFromRationalPoints4D(
  824.     TQ3BoundingBox                 *bBox, 
  825.     const TQ3RationalPoint4D     *pts, 
  826.     unsigned long                 nPts,
  827.     unsigned long                structSize);
  828.  
  829.  
  830. /******************************************************************************
  831.  **                                                                             **
  832.  **                                Sphere Routines                                 **
  833.  **                                                                             **
  834.  *****************************************************************************/
  835.  
  836. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Copy(
  837.     const TQ3BoundingSphere     *src, 
  838.     TQ3BoundingSphere             *dest);
  839.     
  840. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Union(
  841.     const TQ3BoundingSphere     *s1, 
  842.     const TQ3BoundingSphere     *s2,
  843.     TQ3BoundingSphere            *result);
  844.  
  845. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Set(
  846.     TQ3BoundingSphere             *bSphere,
  847.     const TQ3Point3D             *origin, 
  848.     float                        radius,
  849.     TQ3Boolean                    isEmpty);
  850.     
  851. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_UnionPoint3D(
  852.     const TQ3BoundingSphere     *bSphere,
  853.     const TQ3Point3D             *pt3D,
  854.     TQ3BoundingSphere            *result);
  855.     
  856. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_UnionRationalPoint4D(
  857.     const TQ3BoundingSphere     *bSphere,
  858.     const TQ3RationalPoint4D     *pt4D, 
  859.     TQ3BoundingSphere             *result);
  860.  
  861.     
  862. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_SetFromPoints3D(
  863.     TQ3BoundingSphere             *bSphere, 
  864.     const TQ3Point3D             *pts, 
  865.     unsigned long                 nPts,
  866.     unsigned long                structSize);
  867.     
  868. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_SetFromRationalPoints4D(
  869.     TQ3BoundingSphere             *bSphere, 
  870.     const TQ3RationalPoint4D     *pts, 
  871.     unsigned long                 nPts,
  872.     unsigned long                structSize);    
  873.  
  874.  
  875. #ifdef __cplusplus
  876. }
  877. #endif    /* __cplusplus */
  878.  
  879. #endif  /*  QD3DMath_h  */
  880.